package company.nvdia;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Scanner;

public class NV2 {

    static boolean[] nums;

    static int count = 0;

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        List<Integer> list = new ArrayList<>();
        List<Integer> list1 = new ArrayList<>();
        String s;
        int max = 0;
        while (!(s = sc.nextLine()).equals("")) {
            int n = Integer.parseInt(s);
            list1.add(n);
            max = Math.max(max, n);
        }
        nums = new boolean[max + 1];
        judgePrime(max);
        for (Integer i : list1) {
            count = 0;
            getCount(i, 2);
            list.add(count);
        }
        for (Integer i : list) {
            System.out.println(i);
        }
    }

    private static void getCount(int num, int lastNum) {
        if (num <= 0) {
            if (num == 0)
                count++;
            return;
        }
        for (int i = lastNum; i <= num; i++) {
            if (nums[i])
                getCount(num - i, i);
        }
    }

    private static void judgePrime(int n) {
        nums[0] = false;
        nums[1] = false;
        nums[2] = true;
        for (int i = 3; i <= n; i++) {
            if (i % 2 == 0)
                nums[i] = false;
            else {
                for (int j = 3; j < i - 1; j++) {
                    if (i % j == 0) {
                        nums[i] = false;
                        return;
                    }
                    nums[i] = true;
                }
            }
        }
    }
}
